- 以maven-archetype-quickstart建立工程
- pom添加依赖:org.tinygroup.service;org.tinygroup.weblayer
4.0.0 com.qiyi hellomvc 0.0.1-SNAPSHOT jar hellomvc http://maven.apache.org UTF-8 junit junit 3.8.1 test org.tinygroup org.tinygroup.service 2.0.25 org.tinygroup org.tinygroup.weblayer 2.0.25 - 将新建的hellomvc工程加入Web应用主工程的依赖下 1)application.xml加入jar包名前缀
com.qiyi hellomvc 0.0.1-SNAPSHOT Hellomvc示例:Hellomvc方式
注意:现在Web应用主工程save会报错,需要等hellomvc工程完成后才OK - Hellomvc工程添加Action
package com.qiyi.hellomvc.action;import org.tinygroup.weblayer.mvc.annotation.Controller;import org.tinygroup.weblayer.mvc.annotation.RequestMapping;import org.tinygroup.weblayer.mvc.annotation.ResultKey;import org.tinygroup.weblayer.mvc.annotation.View;@Controller()public class HellomvcAction { @RequestMapping(value={"/hellomvc.do"}) @View(value="/hellomvc/result.page") @ResultKey(value="result") public String sayHelloMethod(String name) { if (name == null) { name = "world"; } return String.format("Hello, %s", name); }}
- 添加注解xml
- 添加bean定义xml